<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>set与get练习</title>
    <script src="../../js/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <h2>{{methodsGetText()}}</h2>
      <h2>{{methodsGetText()}}</h2>
      <h2>{{methodsGetText()}}</h2>
      <h2>{{computedGetText}}</h2>
      <h2>{{computedGetText}}</h2>
      <h2>{{computedGetText}}</h2>
    </div>
    <script>
      var v_app = new Vue({
        el: "#app",
        data: {
          text_1: "hello",
          text_2: "apple",
        },
        methods: {
          methodsGetText: function () {
            console.log("methods方法执行");
            return this.text_1 + " " + this.text_2;
          },
        },
        computed: {
          computedGetText: function () {
            console.log("computed方法执行");
            return this.text_1 + " " + this.text_2;
          },
        },
      });
    </script>
  </body>
</html>
